Exports a certificate from the certificate store to a PFX file.
Syntax:
- <lRetVal> = object.ExportCertificatePfx(<sSubjectName>, <sIssuerName>, <sHexSerialNumber>, <sPassword>, <fExportPrivateKey>, <sFileName>)
Parameters:
- sSubjectName – Subject name of certificate to export.
- sIssuerName – Issuer name of certificate.
- sHexSerialNumber – Serial number of the certificate in hexadecimal notation.
- sPassword – Password to secure the PFX content.
- fExportPrivateKey – Specify TRUE (1) or FALSE (0) to export the private key with the certificate.
- sFileName – Full path and name of PFX file to create. If the file already exists, it will be overwritten without warning.
Returns:
Returns 1 if the operation is successful; otherwise returns 0 if the operation fails.
Remarks:
The sSubjectName, sIssuerName and sHexSerialNumber are used to search for the certificate in the certificate store. See Locating a Digital Certificate.
If fExportPrivateKey is TRUE, the private key is packaged with the certificate in the PFX file. If this flag is TRUE and the private key of the certificate does not exist then an error is generated. If fExportPrivateKey is FALSE, only the certificate is exported to the PFX file whether the private key exists for it or not.